<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\api\logic;

use app\common\logic\LogicBase;
use \tpfcore\Core;
use think\Validate;

class MiniProgramColumn extends ApiBase
{
    public function get_Nav($data = [])
    {
        $data = $this->field('sort,display', true)->where(['display' => 1])->order('sort asc')->select();
        foreach ($data as $key => $value) {
            if ($value['img'] && !preg_match('/^http(s)?:\\/\\/.+/', $value['img'])) {
                $data[$key]['img'] = SITE_PATH . $value['img'];
            }
        }

        $result['style']=empty(config("config.mimi_program")['setting']['init']['nav_style'])?1:config("config.mimi_program")['setting']['init']['nav_style'];

        $result['data']=$data;

        return [0, 'success', $result];
    }
}